package extras.mak001;

import com.rsbuddy.script.methods.Players;
import com.rsbuddy.script.task.LoopTask;
import com.rsbuddy.script.util.Timer;

public class AnimWatcher extends LoopTask {
	private static boolean isIdle;
	private static Timer Idle = new Timer(5000);
	private static boolean stop = false;

	public int loop() {
		if (stop == true)
			stop();
		else
			isIdle = LocalIsIdle();
		return 100;
	}

	private boolean LocalIsIdle() {
		if (Players.getLocal().getAnimation() != -1) {
			Idle.reset();
			return false;
		} else if (Players.getLocal().getAnimation() == -1 && !Idle.isRunning()) {
			return true;
		} else {
			return false;
		}
	}

	public static boolean isIdle() {
		return isIdle;
	}

	public static long getTime() {
		return Idle.getRemaining();
	}

	public static void reset() {
		Idle.reset();
	}

	public static void setStop(boolean b) {
		stop = b;
	}
}